package rhc.singleNodeSpider.execute;

import rhc.singleNodeSpider.BasicComponent;
import rhc.singleNodeSpider.spiderManage.SpiderManage;
import rhc.taskSchedule.taskSignalCall.CallCustom;

/**注册到任务调度器
 * @author rhc
 *
 */
public class TaskScheduleCallSpider extends BasicComponent implements CallCustom {

	private SpiderManage spiderManage;
	
	private String runningId;
	
	private String taskId;
	
	public TaskScheduleCallSpider(SpiderManage spiderManage,String runningId,String taskId){
		this.spiderManage=spiderManage;
		this.runningId=runningId;
		this.taskId=taskId;
	}
	
	@Override
	public String getRunningId() throws Exception {
		return runningId;
	}

	@Override
	public String getTaskId() throws Exception {
		return taskId;
	}

	@Override
	public void run() throws Exception {
		spiderManage.regainTask(taskId);
	}

	@Override
	public void stop() throws Exception {
		spiderManage.stopTask(taskId);
	}

	@Override
	public void pause() throws Exception {
		spiderManage.pauseTask(taskId);
	}

	@Override
	public void regain() throws Exception {
		spiderManage.regainTask(taskId);
	}

}
